package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.query.SearchQueryObject;
import cn.wolfcode.trip.base.service.ISearchService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ISearchService searchService;

    /**
     * 查询分类
     *
     */
    @GetMapping("/selectByType")
    public PageInfo selectByType(SearchQueryObject qo) {
        return searchService.queryTypeForList(qo);
    }

    /**
     *查询总数
     */
    @GetMapping("/selectCount")
    public Map queryForCount(SearchQueryObject qo) {

        return searchService.queryForCount(qo);
    }
    /**
     *查询全部
     */
    @GetMapping("/selectAll")
    public PageInfo selectAll(SearchQueryObject qo) {
        return searchService.selectAll(qo);
    }
}
